<include file="Index/Common/header" title="ThinkPHP框架" keywords="开源WEB开发框架"/>
<include file="Index/Common/size-nav"/>
<div id="main">
  <div class="content_wrapper">
<style media="screen">
  {
    display: inline;
  }
</style>
      <div class="container-fluid">
          <div class="row">
              <div class="col-sm-12">
                  <aside>
                      <header><i class="fa fa-fw fa-file"></i>文章分类</header>
                      <section>
                          <div class="container-fluid">
                              <div class="row">
                                  <div class="col-sm-12">
                                    <div class="btn-group" style="margin-bottom:20px;">
                                        <a class="btn btn-default" id="add-item"><i class="fa fa-file-o"></i>添加</a>
                                    </div>
                                      <div class="table-responsive">
                                          <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                              <thead>
                                              <tr>
                                                  <th width="80">id</th>
                                                  <th width="160">分类名</th>
                                                  <!-- <th>父分类</th> -->
                                                  <th width="70">状态</th>
                                                  <th width="160">添加时间</th>
                                                  <th width="140">操作</th>
                                              </tr>
                                              </thead>
                                              <tbody>
                                                <volist name="list" id="list">
                                                  <tr>
                                                      <td>{$list.type_id}</td>
                                                      <td>{$list.title}</td>
                                                      <!-- <td>{$list.fMenu}</td> -->
                                                      <td>{$list.status|getStatus}</td>
                                                      <td>{$list.create_time|date="Y-m-d H:i",###}</td>
                                                      <td>
                                                          <button type="button" class="btn btn-info btn-xs btn-change" attr-id="{$list.type_id}">修改</button>
                                                          <button type="button" class="btn btn-warning btn-xs btn-del" attr-id="{$list.type_id}">删除</button>
                                                      </td>
                                                  </tr>
                                                </volist>
                                              </tbody>
                                          </table>
                                      </div>
                                      <nav>
                                          <ul class="pagination">
                                            {$pageRes}
                                          </ul>
                                      </nav>
                                  </div>
                              </div>
                          </div>
                      </section>
                  </aside>
              </div>
          </div>
      </div>

  </div>

</div>
<include file="Index/Common/footer"/>
<script type="text/javascript">
  var URL = {
    'add_url':"{:U('Admin/NewsType/add')}",
    'edit_url':"{:U('Admin/NewsType/edit')}",
    'del_url':"{:U('Admin/NewsType/setStatus')}",
    'jump_url':"{:U('Admin/NewsType/index')}",
  }
  $("#add-item").on('click',function(){
    layer.confirm('', {
      title:'请输入文章分类',
      content:'<label>文章分类：</label><input type=text name=title />',
      btn: ['确定','取消'] //按钮
    }, function(){
      var title = $('input[name=title]').val();
      $.post(URL.add_url,{'title':title},function(res){
        if(res.code ==200){
          return dialog.success(res.message,URL.jump_url);
        }
        if(res.code == 400){
          return dialog.error(res.message);
        }
      },'json');
    }, function(){
      layer.close();
  });
});
</script>
</body>
</html>
